home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11092 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  34 lines

  1. Path: news.citenet.net!g34-85
  2. From: kabir@citenet.net (larry mintz)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How do I read a random I/O file  into a  structure ?
  5. Date: Thu, 21 Mar 96 22:27:01 GMT
  6. Organization: CiteNet Telecom - Commercial Internet Service
  7. Message-ID: <4isl5t$guk@cti01.citenet.net>
  8. References: <4iskkm$guk@cti01.citenet.net>
  9. NNTP-Posting-Host: g34-85.citenet.net
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12.  
  13. I have the following data in a file called log.dat.It represents the login/out
  14. times of people on a network:  The fields are
  15.                   NAME    LOGIN_TIME  LOGOUT_TIME  PORT
  16. with the following data:
  17.                   kthomas   3:30:45      4:00:00    23
  18.                   urstupid  5:12:12                 67
  19.                   iamsmart  12:34:11     13:23:11   90
  20.                   kthomas   14:23:11     15:12:45   23
  21.                   urstupid   5:30:12     6:00:00    25
  22.  
  23. The structure I am using is 
  24.           struct xx{ char NAME[10];
  25.                      char LOGIN_TIME[10];
  26.                      char  LOGOUT_TIME[10];
  27.                      unsigned PORT:5;
  28.                    };
  29. struct xx LOGTABLE[10];     
  30.  
  31. Question: How do I load log.dat into the struct LOGTABLE[10] so all the data 
  32. is in the proper fields?
  33. kabir.   
  34.